<?php
class project extends baseController {    
	public function __construct() {
		parent::__construct ();
	}
    
    public function loadView($temp) {
        if (!isset($temp["data"]))
            $temp["data"] = '';
        $this->load->view("template", $temp);
    }
    
    public function index() {
        $this->session->set_userdata('selectedMenu', 'project');
        $projects = $this->projectModel->get_by(array('languageCode' => $this->session->userdata('languageCode')));
        $this->_data["template"] = 'project';
        $this->_data["data"] = $projects;
        $this->loadView($this->_data);
    }
    
    public function view($slug) {
        $this->session->set_userdata('selectedMenu', 'project');
        $project = $this->projectModel->read(array('slug' => $slug, 'languageCode' => $this->session->userdata('languageCode')));
        $this->_data["template"] = 'pro';
        $this->_data["data"] = $project;
        $this->loadView($this->_data);
    }
}
?>